home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / scsiDiskBoot / RCS / local.mk,v < prev    next >
Encoding:
Text File  |  1990-09-17  |  9.6 KB  |  398 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    rab:1.2; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.2
  10. date     90.02.15.02.41.30;  author rab;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     90.02.15.01.08.59;  author rab;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Set up distribution stuff.
  27. @
  28. text
  29. @#
  30. # Makefile for boot programs in general.
  31. # This is included by Makefile.boot after $(TM).md/md.mk is included
  32. # The following variables should be defined already:
  33. #    NAME        program to be created
  34. #    OBJS        object files from which to create it
  35. #    CLEANOBJS    object files to be removed as part of "make clean"
  36. #            (need not just be object files)
  37. #    SRCS        sources for dependency generation
  38. #    TM        target machine type for object files, etc.
  39. #    TM        target machine type for object files etc.
  40. #    MACHINES    list of all target machines currently available
  41. #    INSTALLDIR    place to install program
  42. #    LINKSTART    address at which the boot program should be linked.
  43. #
  44. # Optional variables that may be defined by the invoker:
  45. #    XAFLAGS        additional flags to pass to assembler
  46. #    XCFLAGS        additional flags to pass to linker
  47. #    DEPFLAGS    additional flags to pass to makedepend
  48. #    no_targets    if defined, this file will not define all of the
  49. #            basic targets (make, make clean, etc.)
  50. #    use_version    if defined, then this file will set things up
  51. #            to include a version number that is automatically
  52. #            incremented
  53. #
  54. # $Header: /sprite/src/boot/scsiDiskBoot/RCS/local.mk,v 1.1 90/02/15 01:08:59 rab Exp Locker: rab $
  55. #
  56.  
  57. #
  58. # The variables below should be defined in md.mk, but they are given
  59. # default values just in case md.mk doesn't exist yet.
  60. #
  61. HDRS        ?=
  62. OBJS        ?=
  63. SRCS        ?=
  64.  
  65. #
  66. # First define search paths for libraries, include files, lint libraries,
  67. # and even sources.
  68. #
  69. .PATH.h        :
  70. .PATH.h        : . $(TM).md /sprite/src/kernel/Include /sprite/src/kernel/Include/$(TM).md /sprite/src/kernel/dev /sprite/src/kernel/dev/$(TM).md /sprite/src/kernel/fs /sprite/src/kernel/fs/$(TM).md /sprite/lib/include /sprite/lib/include/$(TM).md 
  71. .PATH.ln    : /sprite/lib/lint
  72. .PATH.c        :
  73. .PATH.c        : $(TM).md
  74. .PATH.s        :
  75. .PATH.s        : $(TM).md
  76.  
  77. #
  78. # Important directories. 
  79. #
  80. MISCLIBDIR    = /sprite/lib/misc
  81. BINDIR        = /sprite/cmds.$(MACHINE)
  82.  
  83. #
  84. # System programs -- assign conditionally so they may be redefined in
  85. # including makefile
  86. #
  87. AS        ?= $(BINDIR)/as
  88. CC        ?= $(BINDIR)/cc
  89. CHGRP        ?= $(BINDIR)/chgrp
  90. CHMOD        ?= $(BINDIR)/chmod
  91. CHOWN        ?= $(BINDIR)/chown
  92. CP        ?= $(BINDIR)/cp
  93. CPP        ?= $(BINDIR)/cpp -traditional -$
  94. CTAGS        ?= $(BINDIR)/ctags
  95. ECHO        ?= $(BINDIR)/echo
  96. LD        ?= $(BINDIR)/ld
  97. LINT        ?= $(BINDIR)/lint
  98. MAKEDEPEND    ?= $(BINDIR)/makedepend
  99. MKVERSION    ?= $(BINDIR)/mkversion
  100. MV        ?= $(BINDIR)/mv
  101. RM        ?= $(BINDIR)/rm
  102. SED        ?= $(BINDIR)/sed
  103. TEST            ?= $(BINDIR)/test
  104. TOUCH        ?= $(BINDIR)/touch
  105. UPDATE        ?= $(BINDIR)/update
  106.  
  107. #
  108. # Several variables (such as where to install) are set based on the
  109. # TYPE variable.  Of course, any of these variables can be overridden
  110. # by explicit assignments.
  111. #
  112. TYPE        ?= boot
  113. INSTALLDIR    ?= /sprite/boot
  114. TMINSTALLDIR    ?= /sprite/boot.$(TM)
  115.  
  116. #
  117. # Figure out what stuff we'll pass to sub-makes.
  118. #
  119. PASSVARS    = 'INSTALLDIR=$(INSTALLDIR)' 'TM=$(TM)' $(.MAKEFLAGS)
  120. #ifdef        XCFLAGS
  121. PASSVARS    += 'XCFLAGS=$(XCFLAGS)'
  122. #endif
  123. #ifdef        XAFLAGS
  124. PASSVARS    += 'XAFLAGS=$(XAFLAGS)'
  125. #endif
  126. #ifdef        NOBACKUP
  127. PASSVARS    += 'NOBACKUP=$(NOBACKUP)'
  128. #endif
  129.  
  130. #
  131. # Flags. These are ones that are needed by *all* boot programs. Any other
  132. # ones should be added with the += operator in the local.mk file.
  133. # The FLAGS variables are defined with the += operator in case this file
  134. # is included after the main makefile has already defined them...
  135.  
  136. #include     <tm.mk>
  137.  
  138. XCFLAGS        ?=
  139. XAFLAGS        ?=
  140. LINTFLAGS    ?= -m$(TM)
  141. INSTALLFLAGS    ?=
  142. LDFLAGS        ?=
  143. AFLAGS        += $(TMAFLAGS) $(XAFLAGS)
  144. CFLAGS        += $(TMCFLAGS) $(XCFLAGS) -I. -I$(TM).md  -DKERNEL \
  145.         -I../../kernel/Include/$(TM).md -I../../kernel/Include \
  146.         -I../../kernel/fs -I../../kernel/fs/$(TM).md \
  147.         -I../../kernel/dev -I../../kernel/dev/$(TM).md -DNO_PRINTF -O
  148.  
  149. # KERNELSTART is the absolute address at which the kernel expects to have
  150. # its code loaded.
  151. # LINKSTART is where the boot program is loaded into memory.  It has
  152. # to be loaded high enough so that the kernel image it loads does
  153. # not overwrite the boot program.  (If it does, it generally happens
  154. # as it zeros out the bss segment.  The PROM will abort with Exception 10
  155. # or something immediately after the boot program prints out the kernel sizes.)
  156. # BOOTDIR is the directory in which the boot things live.
  157. #
  158.  
  159. #if !empty(TM:Msun3)
  160. KERNELSTART    ?= 0x4000
  161. LINKSTART    ?= $(KERNELSTART:s/0x/b/)
  162. #else
  163. KERNELSTART    ?= 0x4000
  164. LINKSTART    ?= $(KERNELSTART:s/0x/b/)
  165. #endif
  166.  
  167. CFLAGS        += -DBOOT_CODE=0x$(LINKSTART) \
  168.         -DKERNEL_START=$(KERNELSTART) -DBOOTDIR=\"$(INSTALLDIR)\"
  169.  
  170.  
  171. #
  172. # The .INCLUDES variable already includes directories that should be
  173. # used by cc and other programs by default.  Remove them, just so that
  174. # the output looks cleaner.
  175.  
  176. #if empty(TM:Msun4)
  177. CFLAGS        += $(.INCLUDES:S|^-I/sprite/lib/include$||g:S|^-I/sprite/lib/include/$(TM).md$||g)
  178. #else
  179. CFLAGS        += $(.INCLUDES)
  180. #endif
  181.  
  182. #
  183. # Transformation rules: these have special features to place .o files
  184. # in md subdirectories, run preprocessor over .s files, etc.
  185. # There are no profile rules for boot programs because they aren't profiled.
  186. #
  187.  
  188. .c.o        :
  189.     $(RM) -f $(.TARGET)
  190.     $(CC) $(CFLAGS) -c $(.IMPSRC) -o $(.TARGET)
  191. .s.o    :
  192.     $(CPP) $(CFLAGS:M-[ID]*) -D$(TM) $(.IMPSRC) > $(.PREFIX).pp
  193.     $(AS) -o $(.TARGET) $(AFLAGS) $(.PREFIX).pp
  194.     $(RM) -f $(.PREFIX).pp
  195.  
  196. #
  197. # The following targets are .USE rules for creating things.
  198. #
  199.  
  200. #
  201. # MAKEBOOT usage:
  202. #    <program> : <objects> <libraries> MAKEBOOT
  203. #
  204. # Similar to MAKECMD, except it doesn't create the version.[ho] files,
  205. # and the variable LINKSTART is used to define where the boot program
  206. # gets loaded.
  207. #
  208. MAKEBOOT    :  .USE -lc
  209.     rm -f $(.TARGET)
  210.     $(LD) -N -e start -T $(LINKSTART) $(CFLAGS:M-L*) $(LDFLAGS) \
  211.         -o $(.TARGET) $(.ALLSRC:N-lc:Nend.o) -lc $(.ALLSRC:Mend.o)
  212.  
  213. #
  214. # MAKEINSTALL usage:
  215. #    install : <dependencies> MAKEINSTALL
  216. #
  217. # The program is installed in $(TMINSTALLDIR) and backed-up to
  218. # $(TMINSTALLDIR).old
  219. #
  220. #ifndef NOBACKUP
  221. BACKUP        = -b $(TMINSTALLDIR).old
  222. #else
  223. BACKUP        =
  224. #endif  NOBACKUP
  225.  
  226. MAKEINSTALL    : .USE
  227.     /sprite/admin.$(MACHINE)/makeboot $(TM).md/$(NAME) $(TMINSTALLDIR)/$(NAME)
  228.  
  229. #
  230. # MAKELINT usage:
  231. #    <fluff-file> : <sources to be linted> MAKELINT
  232. #
  233. # <fluff-file> is the place to store the output from the lint.
  234. #
  235. MAKELINT    : .USE
  236.     $(RM) -f $(.TARGET)
  237.     $(LINT) $(LINTFLAGS) $(CFLAGS:M-[ID]*) $(.ALLSRC) > $(.TARGET) 2>&1
  238.  
  239. #
  240. # MAKEDEPEND usage:
  241. #    <dependency-file> : <sources> MAKEDEPEND
  242. #
  243. # Generate dependency file suitable for inclusion in future makes.
  244.  
  245. MAKEDEPEND    : .USE
  246.     @@$(TOUCH) $(DEPFILE)
  247.     $(MAKEDEPEND) $(CFLAGS:M-[ID]*) -m $(TM) -w60 -f $(DEPFILE) $(.ALLSRC)
  248.     @@$(MV) -f $(DEPFILE) $(DEPFILE).tmp
  249.     @@$(SED) -e '/^#/!s|^.|$(TM).md/&|' <$(DEPFILE).tmp > $(DEPFILE)
  250.     @@$(RM) -f $(DEPFILE).tmp
  251.  
  252. #if !defined(no_targets) && defined(NAME)
  253. #
  254. # We should define the main targets (make, make install, etc.).  See the
  255. # mkmf man page for details on what these do.
  256. #
  257. LIBS            ?=
  258.  
  259. #
  260. # start.o must come first
  261. default            : $(TM).md/$(NAME)
  262. $(TM).md/$(NAME)    : $(TM).md/start.o $(OBJS:s/$(TM).md\/start.o//:s/makeBoot.o//) MAKEBOOT
  263.  
  264.  
  265. clean            :: .NOEXPORT tidy 
  266.     $(RM) -f $(TM).md/$(NAME) $(TM).md/$(NAME)$(PROFSUFFIX)
  267.  
  268. tidy            :: .NOEXPORT 
  269.     $(RM) -f $(CLEANOBJS) $(CLEANOBJS:M*.o:S/.o$/.po/g) \
  270.             y.tab.c lex.yy.c core \
  271.         $(TM).md/lint \
  272.         a.out *~ $(TM).md/*~ version.h gmon.out mon.out
  273.  
  274. DEPFILE = $(TM).md/dependencies.mk
  275.  
  276. depend            : $(DEPFILE)
  277. $(DEPFILE)        ! $(SRCS:M*.c) $(SRCS:M*.s) MAKEDEPEND
  278.  
  279.  
  280. #
  281. # For "install", a couple of tricks.  First, allow local.mk to disable
  282. # by setting no_install.  Second, use :: instead of : so that local.mk
  283. # can augment install with additional stuff.  Third, don't install if
  284. # TMINSTALLDIR isn't set.
  285. #
  286. #ifndef no_install
  287. #ifdef TMINSTALLDIR
  288. install            :: $(TM).md/$(NAME) installman MAKEINSTALL
  289. #else
  290. install            :: .SILENT
  291.     echo "Can't install $(NAME):  no install directory defined"
  292. #endif TMINSTALLDIR
  293. #endif no_install
  294.  
  295.  
  296. #if empty(MANPAGES)
  297. installman        :: .SILENT
  298.     echo "There's no man page for $(NAME).  Please write one."
  299. #elif !empty(MANPAGES:MNONE)
  300. installman        ::
  301.  
  302. #elif defined(INSTALLMAN)
  303. installman        :: .SILENT
  304.     $(UPDATE) -m 444 -l $(INSTALLMANFLAGS) $(MANPAGES) $(INSTALLMAN)
  305. #else
  306. installman        :: .SILENT
  307.     echo "Can't install man page(s): no install directory defined"
  308. #endif
  309.  
  310.  
  311. lint            : $(TM).md/lint
  312. $(TM).md/lint        : $(SRCS:M*.c) $(HDRS) $(LIBS:M-l*) MAKELINT
  313.  
  314.  
  315. mkmf            :: .SILENT
  316.     mkmf
  317.  
  318.  
  319. newtm            :: .SILENT
  320.     if test -d $(TM).md; then
  321.         true
  322.     else
  323.         mkdir $(TM).md;
  324.         chmod 775 $(TM).md;
  325.         mkmf
  326.     fi
  327.  
  328. #
  329. # No profiling for boot programs
  330. #
  331. #profile            : $(TM).md/$(NAME)$(PROFSUFFIX)
  332. #$(TM).md/$(NAME)$(PROFSUFFIX)    : $(OBJS:S/.o$/.po/g) $(LIBS:S/.a$/_p.a/g)
  333. #    $(RM) -f $(.TARGET)
  334. #    $(CC) $(CFLAGS) -pg -o $(.TARGET) $(.ALLSRC)
  335.  
  336.  
  337. tags            :: $(SRCS:M*.c) $(HDRS)
  338.     $(CTAGS) $(CTFLAGS) $(SRCS:M*.c)
  339.  
  340. #
  341. # No version header for boot programs
  342. #
  343. #version.h        :
  344. #    $(RM) -f version.h
  345. #    $(MKVERSION) > version.h
  346.  
  347. #include    <all.mk>
  348.  
  349. #endif no_targets && NAME
  350.  
  351. .MAKEFLAGS    : -C        # No compatibility needed
  352.  
  353. #include    <rdist.mk>
  354.  
  355. DISTFILES    ?=
  356.  
  357. dist        !
  358. #if defined(DISTDIR) && !empty(DISTDIR)
  359.     for i in Makefile local.mk $(TM).md/md.mk \
  360.         $(MANPAGES) $(SRCS) $(HDRS)
  361.     do
  362.     if $(TEST) -e $${i}; then
  363.         $(UPDATE)  $${i} $(DISTDIR)/$${i} ;else true; fi
  364.     done
  365. #else
  366.     @@echo "Sorry, no distribution directory defined"
  367. #endif
  368.  
  369.  
  370. @
  371.  
  372.  
  373. 1.1
  374. log
  375. @Initial revision
  376. @
  377. text
  378. @d26 1
  379. a26 1
  380. # $Header: /sprite/lib/pmake/RCS/boot.mk,v 1.2 89/06/02 11:53:54 brent Exp Locker: jhh $
  381. d61 4
  382. a65 2
  383. LD        ?= $(BINDIR)/ld
  384. CP        ?= $(BINDIR)/cp
  385. d68 1
  386. d70 1
  387. a71 1
  388. MAKEDEPEND    ?= $(BINDIR)/makedepend
  389. d74 2
  390. d77 1
  391. a77 4
  392. SED        ?= $(BINDIR)/sed
  393. CHOWN        ?= $(BINDIR)/chown
  394. CHGRP        ?= $(BINDIR)/chgrp
  395. CHMOD        ?= $(BINDIR)/chmod
  396. d326 16
  397. @
  398.